<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>服务套餐类型管理</title>
    <link href="./js/bootstrap.min.css" rel="stylesheet">
    <link href="./js/bootstrap-icons.css" rel="stylesheet">
    <link rel="stylesheet" href="./css/index.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f8fafc;
        }

        /* 顶部导航栏 */
        .top-nav {
            height: 60px;
            background-color: #2563eb;
            color: white;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 20px;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
        }

        .logo {
            font-size: 20px;
            font-weight: bold;
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        /* 主体布局 */
        .main-container {
            display: flex;
            margin-top: 60px;
            height: calc(100vh - 60px);
        }

        /* 左侧菜单栏 */
        .sidebar {
            width: 220px;
            background-color: #1e293b;
            color: white;
            height: 100%;
            position: fixed;
            overflow-y: auto;
            transition: all 0.3s;
            z-index: 900;
        }

        .sidebar.collapsed {
            width: 80px;
        }

        .menu-toggle {
            padding: 15px 20px;
            cursor: pointer;
            border-bottom: 1px solid #334155;
        }

        .menu-items {
            padding: 10px 0;
        }

        .menu-item {
            padding: 12px 20px;
            display: flex;
            align-items: center;
            gap: 12px;
            cursor: pointer;
            transition: background 0.2s;
            position: relative;
        }

        .menu-item:hover {
            background-color: #334155;
        }

        .menu-item.active {
            background-color: #2563eb;
        }

        .menu-text {
            white-space: nowrap;
            overflow: hidden;
        }

        .sidebar.collapsed .menu-text {
            display: none;
        }

        .sidebar.collapsed .menu-item {
            justify-content: center;
        }

        /* 内容区 */
        .content {
            flex: 1;
            margin-left: 220px;
            padding: 20px;
            transition: margin-left 0.3s;
        }

        .sidebar.collapsed ~ .content {
            margin-left: 80px;
        }

        /* 页面标题与操作 */
        .page-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .page-title {
            font-size: 24px;
            font-weight: 600;
            color: #1e293b;
        }

        /* 按钮样式 */
        .btn {
            padding: 8px 16px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
            border: none;
            margin: 0 5px;
        }

        .btn-primary {
            background-color: #2563eb;
            color: white;
        }

        .btn-success {
            background-color: #10b981;
            color: white;
        }

        .btn-warning {
            background-color: #f59e0b;
            color: white;
        }

        .btn-danger {
            background-color: #ef4444;
            color: white;
        }

        .btn-outline {
            background-color: transparent;
            border: 1px solid #cbd5e1;
            color: #64748b;
        }

        .btn-sm {
            padding: 4px 8px;
            font-size: 12px;
        }

        /* 卡片样式 */
        .card {
            background: white;
            border-radius: 8px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            padding: 20px;
            margin-bottom: 20px;
        }

        /* 筛选器 */
        .filter-row {
            display: flex;
            gap: 15px;
            align-items: end;
            flex-wrap: wrap;
            margin-bottom: 20px;
        }

        .filter-item {
            flex: 1;
            min-width: 150px;
        }

        .filter-item label {
            display: block;
            margin-bottom: 5px;
            font-weight: 500;
        }

        .filter-item input,
        .filter-item select {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #cbd5e1;
            border-radius: 4px;
        }

        .filter-actions {
            display: flex;
            gap: 10px;
            align-items: end;
        }

        /* 表格样式 */
        .table-container {
            overflow-x: auto;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th, td {
            padding: 12px;
            text-align: left;
            border-bottom: 1px solid #e2e8f0;
        }

        th {
            background-color: #f1f5f9;
            font-weight: 600;
            color: #1e293b;
        }

        tr:hover {
            background-color: #f8fafc;
        }

        /* 状态标签 */
        .status-badge {
            padding: 4px 8px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 500;
        }

        .status-active {
            background-color: #dcfce7;
            color: #166534;
        }

        /* 弹窗样式 */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.5);
            z-index: 2000;
            align-items: center;
            justify-content: center;
        }

        .modal.show {
            display: flex;
        }

        .modal-content {
            background: white;
            border-radius: 8px;
            width: 600px;
            max-width: 90%;
            max-height: 90%;
            overflow-y: auto;
        }

        .modal-header {
            padding: 20px;
            border-bottom: 1px solid #e2e8f0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .modal-body {
            padding: 20px;
        }

        .modal-footer {
            padding: 20px;
            border-top: 1px solid #e2e8f0;
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }

        .close {
            font-size: 24px;
            cursor: pointer;
        }

        /* 表单样式 */
        .form-group {
            margin-bottom: 15px;
        }

        .form-group label {
            display: block;
            margin-bottom: 5px;
            font-weight: 500;
        }

        .form-group input,
        .form-group select,
        .form-group textarea {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #cbd5e1;
            border-radius: 4px;
        }

        .form-section {
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 1px solid #e2e8f0;
        }

        .form-section:last-child {
            border-bottom: none;
        }

        .section-title {
            font-size: 16px;
            font-weight: 600;
            color: #1e293b;
            margin-bottom: 15px;
        }

        /* 单选按钮样式 */
        .radio-group {
            display: flex;
            gap: 20px;
            margin: 10px 0;
        }

        .radio-item {
            display: flex;
            align-items: center;
            gap: 5px;
        }

        /* 动态显示区域 */
        .dynamic-section {
            display: none;
        }

        .dynamic-section.active {
            display: block;
        }

        /* 响应式 */
        @media (max-width: 768px) {
            .filter-row {
                flex-direction: column;
            }
            
            .filter-item {
                min-width: 100%;
            }
        }
    </style>
</head>
<body>
    <!-- 顶部导航栏 -->
    <div class="top-nav">
        <div class="logo">洗头机器人服务平台管理系统</div>
        <div class="user-info">
            <div class="notification-icon">🔔 通知中心</div>
            <div class="user-dropdown">
                <span>张经理 ▼</span>
            </div>
        </div>
    </div>

    <!-- 主体布局 -->
    <div class="main-container">
          <!-- 左侧菜单栏 -->
          <div class="sidebar" id="sidebar">
            <div class="menu-toggle" onclick="toggleSidebar()">☰ 菜单</div>
            <div class="menu-items">
                <div class="menu-item ">
                    <a href="./index.html">
                        <span>📊</span>
                        <span class="menu-text">仪表盘</span>
                    </a>
                  
                </div>
                <div class="menu-item">
                    <a href="./dianpu.html">
                        <span>🏪</span>
                        <span class="menu-text">店铺管理</span>
                    </a>
                   
                </div>
                <div class="menu-item">
                    <a href="./jiqiren.html">
                        <span>🤖</span>
                        <span class="menu-text">机器人管理</span>
                    </a>
                 
                </div>
                <div class="menu-item">
                    <a href="./order.html">
                        <span>📋</span>
                        <span class="menu-text">订单管理</span>
                    </a>
                   
                </div>
                <div class="menu-item ">
                    <span>👥</span>
                    <span class="menu-text">用户会员管理</span>
                    <span>▶</span>
                </div>
                <div class="submenu">
                    <div class="submenu-item">
                        <a href="./user.html">
                            <span>├─</span>
                            <span class="menu-text">用户会员列表</span>
                        </a>
                      
                    </div>
                    <div class="submenu-item ">
                        <a href="./vip.html">
                            <span>├─</span>
                            <span class="menu-text">会员等级配置</span>
                        </a>
                        
                    </div>
                </div>
                <div class="menu-item active">
                    <a href="./fuwu.html">
                        <span>🎯</span>
                        <span class="menu-text">服务套餐类型</span>
                    </a>
                </div>
                <div class="menu-item">
                    <span>🎯</span>
                    <span class="menu-text">促销管理(二期)</span>
                </div>
                <div class="menu-item">
                    <span>📈</span>
                    <span class="menu-text">数据统计(二期)</span>
                </div>
                <div class="menu-item">
                    <span>⚙️</span>
                    <span class="menu-text">系统设置</span>
                </div>
            </div>
        </div>

        <!-- 中间内容区 -->
        <div class="content">
            <!-- 页面标题与操作 -->
            <div class="page-header">
                <h1 class="page-title">服务套餐类型管理</h1>
                <button class="btn btn-primary" onclick="showAddServiceTypeModal()">
                    <i class="bi bi-plus-lg"></i> 新增类型
                </button>
            </div>

            <!-- 筛选器 -->
            <div class="card">
                <div class="filter-row">
                    <div class="filter-item">
                        <label>权益类型</label>
                        <select id="benefitTypeFilter" onchange="filterByBenefitType()">
                            <option value="">全部</option>
                            <option value="次数型服务">次数型服务</option>
                            <option value="折扣型权益">折扣型权益</option>
                        </select>
                    </div>
                    <div class="filter-item">
                        <label>状态</label>
                        <select id="statusFilter" onchange="filterByStatus()">
                            <option value="">全部</option>
                            <option value="启用">启用</option>
                            <option value="停用">停用</option>
                        </select>
                    </div>
                    <div class="filter-item">
                        <label>搜索</label>
                        <div style="display: flex; gap: 10px;">
                            <input type="text" placeholder="请输入名称">
                            <button class="btn btn-primary">🔍</button>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 服务套餐类型表格 -->
            <div class="card">
                <div class="table-container">
                    <table>
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>名称</th>
                                <th>权益类型</th>
                                <th>核心参数</th>
                                <th>有效期</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>ST001</td>
                                <td>三次普通洗头套餐</td>
                                <td>次数型服务</td>
                                <td>总次数：3次</td>
                                <td>90天</td>
                                <td><span class="status-badge status-active">启用</span></td>
                                <td>
                                    <button class="btn btn-outline btn-sm" onclick="editServiceType('ST001')">编辑</button>
                                    <button class="btn btn-outline btn-sm" >启用/禁用</button>
                                </td>
                            </tr>
                            <tr>
                                <td>ST004</td>
                                <td>全场服务9折优惠</td>
                                <td>折扣型权益</td>
                                <td>折扣率：90%</td>
                                <td>30天</td>
                                <td><span class="status-badge status-active">启用</span></td>
                                <td>
                                    <button class="btn btn-outline btn-sm" onclick="editServiceType('ST004')">编辑</button>
                                    <button class="btn btn-danger btn-sm">删除</button>
                                </td>
                            </tr>
                            <tr>
                                <td>ST005</td>
                                <td>满200减50优惠</td>
                                <td>折扣型权益</td>
                                <td>折扣率：- 满200</td>
                                <td>15天</td>
                                <td><span class="status-badge status-active">启用</span></td>
                                <td>
                                    <button class="btn btn-outline btn-sm" onclick="editServiceType('ST005')">编辑</button>
                                    <button class="btn btn-danger btn-sm">删除</button>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <!-- 新增/编辑服务套餐类型弹窗 -->
    <div class="modal" id="serviceTypeModal">
        <div class="modal-content">
            <div class="modal-header">
                <h5 id="modalTitle">新增服务套餐类型</h5>
                <span class="close" onclick="closeServiceTypeModal()">&times;</span>
            </div>
            <div class="modal-body">
                <div class="form-section">
                    <div class="section-title">基本信息</div>
                    <div class="form-group">
                        <label>名称 *</label>
                        <input type="text" id="serviceName" placeholder="请输入套餐名称">
                    </div>
                    <div class="form-group">
                        <label>权益类型 *</label>
                        <div class="radio-group">
                            <div class="radio-item">
                                <input type="radio" name="benefitType" value="次数型服务" id="timesType" checked onchange="toggleBenefitType()">
                                <label for="timesType">次数型服务</label>
                            </div>
                            <div class="radio-item">
                                <input type="radio" name="benefitType" value="折扣型权益" id="discountType" onchange="toggleBenefitType()">
                                <label for="discountType">折扣型权益</label>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 次数型服务参数 -->
                <div class="form-section dynamic-section active" id="timesSection">
                    <div class="section-title">次数型服务参数</div>
                    <div class="form-group">
                        <label>关联服务名称</label>
                        <select>
                            <option value="">请选择服务</option>
                            <option value="普通洗头">普通洗头</option>
                            <option value="头皮护理">头皮护理</option>
                            <option value="深层清洁">深层清洁</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label>总次数 *</label>
                        <input type="number" placeholder="请输入总次数">
                    </div>
                </div>

                <!-- 折扣型权益参数 -->
                <div class="form-section dynamic-section" id="discountSection">
                    <div class="section-title">折扣型权益参数</div>
                    <div class="form-group">
                        <label>折扣率 *</label>
                        <input type="number" placeholder="如90表示9折">
                    </div>
                    <div class="form-group">
                        <label>最低消费限制</label>
                        <input type="number" placeholder="0表示无限制">
                    </div>
                </div>

                <!-- 通用设置 -->
                <div class="form-section">
                    <div class="section-title">通用设置</div>
                    <div class="form-group">
                        <label>有效期 *</label>
                        <input type="number" placeholder="请输入有效期（天）">
                    </div>
                    <div class="form-group">
                        <label>描述</label>
                        <textarea rows="3" placeholder="请输入描述信息"></textarea>
                    </div>
                    <div class="form-group">
                        <label>状态</label>
                        <div>
                            <label>
                                <input type="checkbox" checked> 启用
                            </label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-outline" onclick="closeServiceTypeModal()">取消</button>
                <button class="btn btn-primary" onclick="saveServiceType()">保存</button>
            </div>
        </div>
    </div>

    <script>
        // 切换侧边栏
        function toggleSidebar() {
            const sidebar = document.getElementById('sidebar');
            sidebar.classList.toggle('collapsed');
        }

        // 显示新增服务套餐类型弹窗
        function showAddServiceTypeModal() {
            document.getElementById('modalTitle').textContent = '新增服务套餐类型';
            document.getElementById('serviceName').value = '';
            document.getElementById('timesType').checked = true;
            toggleBenefitType();
            document.getElementById('serviceTypeModal').classList.add('show');
        }

        // 关闭服务套餐类型弹窗
        function closeServiceTypeModal() {
            document.getElementById('serviceTypeModal').classList.remove('show');
        }

        // 切换权益类型显示
        function toggleBenefitType() {
            const timesType = document.getElementById('timesType').checked;
            const timesSection = document.getElementById('timesSection');
            const discountSection = document.getElementById('discountSection');
            
            if (timesType) {
                timesSection.classList.add('active');
                discountSection.classList.remove('active');
            } else {
                timesSection.classList.remove('active');
                discountSection.classList.add('active');
            }
        }

        // 编辑服务套餐类型
        function editServiceType(id) {
            document.getElementById('modalTitle').textContent = '编辑服务套餐类型';
            document.getElementById('serviceName').value = '三次普通洗头套餐';
            document.getElementById('timesType').checked = true;
            toggleBenefitType();
            document.getElementById('serviceTypeModal').classList.add('show');
        }

        // 保存服务套餐类型
        function saveServiceType() {
            alert('服务套餐类型已保存');
            closeServiceTypeModal();
        }

        // 按权益类型筛选
        function filterByBenefitType() {
            const filterValue = document.getElementById('benefitTypeFilter').value;
            // 实际项目中这里会进行数据筛选
            console.log('按权益类型筛选:', filterValue);
        }

        // 按状态筛选
        function filterByStatus() {
            const filterValue = document.getElementById('statusFilter').value;
            // 实际项目中这里会进行数据筛选
            console.log('按状态筛选:', filterValue);
        }

        // 菜单点击事件
        document.querySelectorAll('.menu-item').forEach(item => {
            item.addEventListener('click', function() {
                document.querySelectorAll('.menu-item').forEach(i => i.classList.remove('active'));
                this.classList.add('active');
            });
        });
    </script>
</body>
</html>